import axios from '~/axios'
import { joinPramas } from './manager'

// 获取角色列表信息
export function getRoleList(getParams) {
    //console.log('role list get params: ', getParams)
    let url = '/api/sys/role/list'
    let finalUrl = joinPramas(url, getParams)
    return axios.get(finalUrl)
}

// 新增
export function api_role_add(jsonData) {
    let url = '/api/sys/role/add'
    return axios.post(url, jsonData)
}

// 更新
export function api_role_update(id, jsonData) {
    let url = '/api/sys/role/edit'
    jsonData.id = id
    return axios.post(url, jsonData)
}

// 删除
export function api_role_delete(id) {
    let url = '/api/sys/role/delete/' + id
    return axios.post(url, {})
}

// 获取角色权限
export function api_role_permissions(id) {
    let url = '/api/sys/role/auth/' + id
    return axios.post(url, {})
}

// 角色授权
export function api_role_auth_permissions(jsonData) {
    let url = '/api/sys/role/addAuth'
    return axios.post(url, jsonData)
}